package com.task.core.mapper;

import java.util.Collection;
import java.util.List;

import cn.hutool.bloomfilter.bitMap.LongMap;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.task.common.domain.info.KeyAndValue;
import com.task.common.info.DeviceFraudInfo;
import com.task.common.info.DeviceGroupInfo;
import com.task.common.info.FlowFilterInfo;
import com.task.common.info.IpFraudInfo;
import com.task.common.info.PluginInfo;
import com.task.common.info.ProxyInfo;
import com.task.core.domain.MissionInfo;
import com.task.core.domain.RelationMissionSourceUseDataCount;
import com.task.core.domain.info.RelationMissionSourceUseDataCountInfo;
import com.task.core.dto.request.MissionRequestDTO;
import com.task.core.task.into.MissionChangeNotNormalInfo;

/**
 * @author 迪迦.
 * @date 2024/11/4 17:33
 */
@Mapper
public interface MissionMapper {

  List<MissionInfo> getMissionByPage(MissionRequestDTO request);

  List<KeyAndValue> getMissionForOption(MissionRequestDTO request);

  void addMission(MissionRequestDTO request);

  Integer modifyMission(MissionRequestDTO request);

  Integer deleteMission(@Param("code") String refererSourceCode, @Param("userId") Long userId);

  void initMissionNormalState(@Param("codes") List<String> codes);

  MissionInfo getMissionByCode(String code);

  Integer checkAuthentication(String authentication);

  void addMissionDeviceGroupRelation(@Param("deviceGroupCodes") List<String> deviceGroupCodes,
      @Param("code") String code);

  List<MissionInfo> getNormalMissionListByGroupCodes(@Param("groupCode") String groupCode);

  void addMissionDeviceFraudRelation(@Param("deviceFraudCodes") List<String> deviceFraudCodes,
      @Param("code") String code);

  void addMissionFlowFilterRelation(@Param("flowFilterRuleCodes") List<String> flowFilterRuleCodes,
      @Param("code") String code);

  void addMissionIpFraudRelation(@Param("ipFraudCodes") List<String> ipFraudCodes,
      @Param("code") String code);

  void addMissionPluginRelation(@Param("pluginCodes") List<String> pluginCodes,
      @Param("code") String code);


  List<DeviceFraudInfo> getDeviceFraudsByCode(@Param("code") String code);

  List<DeviceGroupInfo> getDeviceGroupsByCode(@Param("code") String code);

  List<FlowFilterInfo> getFlowFiltersByCode(@Param("code") String code);

  List<IpFraudInfo> getIpFraudsByCode(@Param("code") String code);

  void deleteMissionDeviceGroupRelation(@Param("code") String code);

  void deleteMissionDeviceFraudRelation(@Param("code") String code);

  void deleteMissionFlowFilterRelation(@Param("code") String code);

  void deleteMissionIpFraudRelation(@Param("code") String code);

  void deleteMissionProxyRelation(@Param("code") String code);

  List<ProxyInfo> getProxiesByCode(@Param("code") String code);

  void deleteMissionPluginRelation(@Param("code") String code);

  List<PluginInfo> getPluginsByCode(@Param("code") String code);

  void incrementFailedCount(String code);

  void addMissionProxyRelation(@Param("proxyCodes") List<String> proxyCodes,
      @Param("code") String code);

  List<String> getMissionForHistory();

  List<MissionInfo> getNotNormalMissionListByGroupCodes(String deptCode);

  void changeMissionStatus(@Param("missionCode") String missionCode, @Param("status") boolean status, @Param("userId") Long userId);

  Long getFailedCountByMissionCode(@Param("missionCode") String missionCode);

  void changeMissionNormalStatusToFalse(@Param("list") List<MissionChangeNotNormalInfo> changeList);

  List<RelationMissionSourceUseDataCount> getInfoByMissionCode(@Param("missionCode") String code);

  void addMissionAndSourceUseCount(@Param("addList") List<RelationMissionSourceUseDataCount> addList);

  void updateMissionAndSourceUseCount(@Param("updateInfo") RelationMissionSourceUseDataCount updateInfo);

  void updateMissionAndSourceAllCountBySourceCode(@Param("addCount") Integer addCount, @Param("dataSourceCode") String dataSourceCode);

  void incrementMissionAndSourceUseCountBySourceCode(@Param("missionCode") String missionCode, @Param("sourceCode") String sourceCode);

  void decrementMissionAndSourceUseCountBySourceCode(@Param("missionCode") String missionCode, @Param("sourceCode") String sourceCode);

  List<RelationMissionSourceUseDataCountInfo> getRelationMissionSourceUseDataCountInfoByMissionCode(@Param("missionCode") String code);

  List<FlowFilterInfo> getFlowFiltersByCodes(@Param("codes")List<String> codes);

  List<PluginInfo> getPluginsByCodes(@Param("codes")List<String> codes);

  List<ProxyInfo> getProxiesByCodes(@Param("codes")List<String> codes);

  List<IpFraudInfo> getIpFraudsByCodes(@Param("codes")List<String> codes);

  List<DeviceGroupInfo> getDeviceGroupsByCodes(@Param("codes")List<String> codes);

  List<DeviceFraudInfo> getDeviceFraudsByCodes(@Param("codes") List<String> codes);

  void updtateMissionStatusByMissionCode(@Param("status")Integer status,@Param("code") String code);

    void updateMissionUseDataCountRelation(@Param("datasourceCode")String datasourceCode);

    void initMission(@Param("missionCode")String missionCode,@Param("userId") Long userId);
}
